Class = {}
Class.BaseClass = {}
Class.Classes = {}
Class.InitialClass = 1

function Class:Get( id )
	return self.Classes[ id ]
end

function Class:IdByName( name )

	for _, v in pairs( Class.Classes ) do
		if v:GetName() == name then
			return v.Id
		end
	end

end


local function ClassChanged( ply, var, old, new )
	ply:SetClass( new )	
end

RegisterNWTablePlayer({ {"PlyClass", 1, NWTYPE_NUMBER, ClassChanged, REPL_TEAMONLY } })


CLASS = {}
include("baseclass.lua")
Class.BaseClass = CLASS

local Classes = file.FindInLua( string.Replace( GM.Folder, "gamemodes/", "" ) .. "/gamemode/class/classes/*.lua") 

for k, v in pairs( Classes ) do

	CLASS = table.Copy( Class.BaseClass )
	
	include("classes/" .. v )
	
	if SERVER then
		AddCSLuaFile("classes/" .. v )
	end
	
	CLASS.Id = k
	
	table.insert( Class.Classes, CLASS )

end

CLASS = nil
Classes = nil